package com.byb.server.service.mapper;

import com.byb.server.domain.*;
import com.byb.server.service.dto.CoverGuideDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity CoverGuide and its DTO CoverGuideDTO.
 */
@Mapper(componentModel = "spring", uses = {ProductMapper.class, })
public interface CoverGuideMapper extends EntityMapper <CoverGuideDTO, CoverGuide> {

    @Mapping(source = "product.id", target = "productId")
    CoverGuideDTO toDto(CoverGuide coverGuide); 

    @Mapping(source = "productId", target = "product")
    CoverGuide toEntity(CoverGuideDTO coverGuideDTO); 
    default CoverGuide fromId(Long id) {
        if (id == null) {
            return null;
        }
        CoverGuide coverGuide = new CoverGuide();
        coverGuide.setId(id);
        return coverGuide;
    }
}
